package org.example.controller;



import jakarta.validation.Valid;
import org.example.common.PageData;
import org.example.common.PageQuery;
import org.example.common.ResponseData;
import org.example.domain.UpdateInfo;
import org.example.domain.UserInfo;
import org.example.domain.UserQuery;
import org.example.service.IUserService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {

    @Autowired
    IUserService iUserService;

//    @RequestMapping(value = "/load",method = RequestMethod.POST)
//    public ResponseData<Integer> load(@RequestBody UserInfo userInfo ){
//        return iUserService.demo(userInfo);
//    }
    @PostMapping("/enRoll")
    public ResponseData<String> enRoll(@RequestBody UserInfo userInfo ){
        return iUserService.enRoll(userInfo);
    }

    @RequestMapping(value = "/page",method = RequestMethod.POST)
    public ResponseData<PageData<UserInfo>> page(@RequestBody @Valid UserQuery userQuery) {
        return iUserService.page(userQuery);
    }

    @RequestMapping(value = "/updateUser",method = RequestMethod.POST)
    public ResponseData<String> updateUser(@RequestBody UpdateInfo updateInfo){
        return iUserService.updateUser(updateInfo);
    }


}
